package com.skit.mine;

import android.text.TextUtils;
import android.view.View;
import android.widget.Toast;

import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;

public class LoginViewModel extends ViewModel {
    //监听属性
    public MutableLiveData<String> name = new MutableLiveData<>();
    public MutableLiveData<String> pwd = new MutableLiveData<>();

    /**
     * 登录点击回调
     */
    public void login(View view) {
        Toast.makeText(view.getContext(), "click login!", Toast.LENGTH_SHORT).show();
    }

    /**
     * 是否可以登录
     */
    public boolean canLogin(String name, String pwd) {
        return !(TextUtils.isEmpty(name) || TextUtils.isEmpty(pwd));
    }


}
